import QtQuick 1.0

Rectangle{
    id: textInput
    height: 50; width: 125;
     color: "#00ffffff";

    property alias textValue: editor.text
    property alias textAlign: editor.horizontalAlignment
    property alias textColor: editor.color;
    property alias borderSrc: inputBorder.source
    property alias cursorVisible: editor.cursorVisible


    /** Border **/
    BorderImage {
        id: inputBorder
        x: 0; y: 0
        anchors.fill: parent;
        border.left: 20; border.right:20;
        border.top: 20; border.bottom:20;
        source: "../images/TextInput_default.png";
    }

    /** Input Text Field **/
    TextInput {
        id: editor
        anchors {
            left: parent.left; leftMargin: 10;
            right: parent.right; rightMargin: 10;
            verticalCenter: parent.verticalCenter;
        }

        color: "#000000";
        font.pixelSize: 22
        font.family: nokiaStandardLight.name
        selectionColor: "#1080DD"
        cursorVisible: false;

        onFocusChanged: {
            if (!editor.activeFocus) {
                textInput.state = "defaultState";
            } else {
                textInput.state = "focusState";
            }
        }
    }

    states: [
        State {
            name: "defaultState"
            PropertyChanges {
                target: textInput
                borderSrc: "../images/TextInput_default.png";
                textColor: "#282828";
                cursorVisible: false;
            }
        },
        State {
            name: "focusState"
            PropertyChanges {
                target: textInput
                borderSrc: "../images/TextInput_active.png";
                textColor: "#282828";
                cursorVisible: true;
            }
        },
        State {
            name: "disabledState"
            PropertyChanges {
                target: textInput
                borderSrc: "../images/TextInput_disabled.png";
                textColor: "#a1a1a1";
                cursorVisible: false;
            }
        }
    ]
}
